package kaoshi.service.impl;
import kaoshi.dao.personDao;
import kaoshi.dao.impl.personDaoImpl;
import kaoshi.entity.person;

import java.util.List;

public class personServiceImpl implements personService {
    personDao dao = new personDaoImpl();

    @Override
    public List<person> selAll() {
        return dao.selAll();
    }

    @Override
    public int delID(int id) {
        int count = 0;
        if (id != 0) {
            count = dao.delID(id);
        } else {
            //删除失败
            count = -1;
        }
        System.out.println(count);
        return count;
    }

    @Override
    public int insert(person person) {
        int count = 0;
        if (person!=null){
            count=dao.insert(person);
        }else{
            count=-1;
        }
        return count;
    }

    @Override
    public int update(person person) {
        int count = 0;
        if (person!=null){
            count = dao.update(person);
        }else{
            count = -1;
        }
        return count;
    }

    @Override
    public List<person> getByPage(int pageNo, int pageSize) {
        List<person> list = dao.getByPage(pageNo,pageSize);
        return list;
    }

    @Override
    public int getByPaged() {
        return dao.getByPaged();
    }

    @Override
    public person inquireMaxId() {
        return dao.inquireMaxId();
    }
}




